1. Field of Applicable Technology
The present invention relates to an image data encoding apparatus for converting image data to compressed form, for use in the data transmission section of a facsimile apparatus, etc. In particular, the invention relates to an image data encoding apparatus of the type in which increased encoding efficiency is achieved by a variable-length encoding method.
2. Description of the Related Art
With a prior art image data encoding apparatus of this type, image data derived by converting an original image to successive data values extending along successive scan lines (e.g. with the scan lines being horizontal and occurring successively along the vertical direction) are encoded using variable length code, e.g. a one-dimensional encoding arrangement such as the Modified Huffman (MH) code or a two-dimensional encoding arrangement such as the Modified Read (MR) code. The MH and MR codes are described in the CCITT Recommendation T.4 (pages 22 to 34), being designated therein as a one-dimensional run length coding scheme and a two-dimensional coding scheme respectively. In the following, for simplicity of description, it will be assumed that each data value of the image data is a single bit, representing one of two possible colors (e.g. the white or black states) of a bi-level picture element, with such a picture element being referred to as a dot. With such encoding, a variable-length code table of the form shown in FIG. 1 is utilized to obtain increased encoding efficiency. FIG. 1 is a code table for the MH encoding scheme mentioned above. In the image data that are to be encoded, a succession of dots which are the same color is referred to as a "run", and each run is encoded as a single predetermined code. For example, if there is a run of four successive white dots in the image data to be encoded, then that will be expressed by the code 1011 in the encoded data, whereas a run of four successive black dots will be expressed by the code 011. Such an encoding method generally provides compression of the amount of data which are outputted from the encoding apparatus, by comparison with the original image data, as is illustrated in the example of FIG. 2. In FIG. 2, an example is shown in which a run of 11 white dots is followed by a run of 3 black dots, with that sequence of 11 white dots and 3 black dots then again occurring, i.e. for a total of 28 bits in the original image data (the latter being referred to in the following as the raw data). Since each run of 11 white dots is expressed by the code 01000 (i.e. five bits) in the encoded data while each run of 3 black dots is expressed by the code 10 (i.e. two bits), it can be seen that the entire 28 bits of raw data can be converted to 14 bits of encoded data, so that the amount of data to be transmitted has been compressed by 14 bits.
Such a variable lengths encoding method however has the disadvantage that in the case of certain types of image, instead of achieving a compression of data by the encoding operation, the amount of encoded data may (at least in some of the scan lines) become substantially greater than the raw data expressing that image. An example of this will be described referring to FIG. 3. In this case, a portion of the raw data for an image is assumed to consist of five dots which are successively white, black, white, black and white, i.e. the run length in each case is 1. An isolated white dot (expressed in the raw data by one bit) is expressed in the encoded data by the code 000111, while a single black dot is encoded as 010. Hence as shown in FIG. 5, the five bits of raw data are expressed by a total of 24 bits in the encoded data, i.e. the amount of data has been increased by 19 bits. It can thus be understood that in the case of an image in which a number of isolated black and white dots occur along some of the scan lines, such a variable length encoding method may result in a considerable increase in the amount of encoded data that is generated for these scan lines, by comparison with the raw data for these scan lines. This is a basic disadvantage of such a prior art image data encoding apparatus.